<%@tag pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<%@tag import="com.oplink.webems.modules.sys.entity.Dict"%>
<%@ attribute name="datasource" type="java.util.List" required="true"%>
<%@ attribute name="dictName" type="java.lang.String" required="false"%>
<%@ attribute name="width" type="java.lang.Integer" required="false"%>
<%@ attribute name="dispVar" type="java.lang.String" required="false"%>
<%@ attribute name="uname" type="java.lang.String" required="false"%>
<%@ attribute name="utype" type="java.lang.String" required="false"%>
<%@ attribute name="all" type="java.lang.String" required="false"%>
<%@ attribute name="allValue" type="java.lang.String" required="false"%>
<%@ attribute name="value" type="java.lang.String" required="false"%>
<%@ attribute name="dataPlaceholder" type="java.lang.String" required="true"%>
<select style="width:${width}px;height:100px;" 
		class="chosen-select" 
		uname="update"
		utype="${utype}"
		id="${dictName}_<%=(int)(Math.random()*1000+1)%>" 
		name="${dictName}" 
		data-placeholder="${dataPlaceholder}">
		<c:if test="${all == true}">
			<c:if test="${allValue != null}">
				<option value="${allValue}">全部</option>
			</c:if>	
			<option value="">全部</option>
		</c:if>
		
		<c:forEach items="${datasource}" var="dict">
			<c:choose>
				<c:when test="${ dispVar == 'type' }">					
					<c:choose>
						<c:when test="${value == dict.type}">
								<option value="${dict.type}" selected="selected">${dict.type}</option>
						</c:when>
						<c:otherwise>
							<option value="${dict.type}">${dict.type}</option>
						</c:otherwise>
					</c:choose>
				</c:when>
				<c:otherwise>
					<c:choose>
						<c:when test="${value == dict.value}">
							<option value="${dict.value}" selected="selected">${dict.label}</option>
						</c:when>
						<c:otherwise>
							<option value="${dict.value}">${dict.label}</option>
						</c:otherwise>
					</c:choose>
				</c:otherwise>
			</c:choose>
		</c:forEach>
</select>
<tags:import includes="chosen,chosenCss"></tags:import>
<script type="text/javascript">
	$(".chosen-select").chosen({no_results_text: "没有匹配结果",disable_search_threshold: 10}); 
</script>